<%@ page language="java" contentType="text/html; charset=utf-8"   pageEncoding="utf-8"%>
<%@ page language="java" import="java.util.*"  %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script src="js/jquery-1.9.1.js"></script>
  </head>
  
  <body>
	<%=path%>
	<%=basePath%>
	${renlist}
	<hr></hr>
    <a onclick="postMethod()">post</a>
    <hr></hr>
    <form action="modul1/1234/bo.do" method="post" enctype="multipart/form-data">
	    <input type="file" name="file_param" />
	    <input type="submit" value="上传文件" />
	    上传结果:${message}
    </form>
    <hr></hr>
	 
  </body>
  <script>
  function postMethod(){
	var data={
		param1:"123",
		param2:"456",
		param3:"789",
	}
	postJsonAjaxRequest(data,"modul1/haobo.do",function(res){
		alert(res)
	});
  }
   function postJsonAjaxRequest(data,url,callback) {
   	 var val=JSON.stringify(data);
   	 alert(val)
     $.ajax({
         url:url,
         type: "POST",
         dataType: "json",
         contentType:"application/json", //这样后台的param才能接收到参数
         data:val,//这里传入json格式字符串
         success: function (res) {//请求成功完成后要执行的方法
             callback(res)
       	  }
	 })
 }
 </script>
</html>
